<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>

<head>
<title>Sans Titre</title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<meta name="generator" content="HAPedit 3.1">
</head>
<body bgcolor="#FFFFFF">
<?php
include "../connexion.php";
	if (isset($_POST['site_id']) and $_POST['site_id']<>0){
		$query = "INSERT INTO `pgsim_flights` ( `id` , `member_id` , `site_id` , `igc` ,
		`wind_direction` , `wind_speed` ,
		`thermals_height` , `thermals_speed` , `thermals_size` , `thermals_density`,
		`comment`, `date` )
		VALUES (
		'', '".$_POST['member_id']."', '".$_POST['site_id']."', '".$_POST['igcFile']."',
		'".$_POST['wind_direction']."', '".$_POST['wind_speed']."',
		'".$_POST['thermal_height']."', '".$_POST['thermal_speed']."', '".$_POST['thermal_size']."', '".$_POST['thermal_density']."' ,
		'".addslashes($_POST['comment'])."' ,  NOW( )
		);";
		if ($result=mysql_query($query)){
			echo "ok, flight saved !! :)<br />";
			$q = "select id from `pgsim_flights` WHERE member_id =  ".$_POST['member_id']." AND site_id =  ".$_POST['site_id']." ORDER BY id DESC LIMIT 1";
			$r = mysql_query($q);
			$v = mysql_fetch_array($r);
			echo "<iframe src='http://www.victorb.fr/visugps/visugps.html?track=http://www.paraglidingearth.com/pgepgsim/raf/viewIGC.php?flight_id=".$v['id']."' width='420px' height='380px'></iframe>";
		}
		else {
			echo "oops, error while saving flight...";
		}
	} else {
		echo "hmm, this flight you are trying to save does not seem to come from a valid flying site....<br />
			well, if you are not a spam robot (??), reach the guys at paraglidingearth.com to report the problem...";
	}
?>
</body>

</html>